<?php

/**
 * filterspec filter form base class.
 *
 * @package    forumCDE
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasefilterspecFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'owner_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('owner'), 'add_empty' => true)),
      'ownerclass'          => new sfWidgetFormFilterInput(),
      'className'           => new sfWidgetFormFilterInput(),
      'fieldName'           => new sfWidgetFormFilterInput(),
      'operator'            => new sfWidgetFormFilterInput(),
      'valueFrom'           => new sfWidgetFormFilterInput(),
      'valueUntil'          => new sfWidgetFormFilterInput(),
      'connector'           => new sfWidgetFormFilterInput(),
      'warningText'         => new sfWidgetFormFilterInput(),
      'whereText'           => new sfWidgetFormFilterInput(),
      'whereParams'         => new sfWidgetFormFilterInput(),
      'joinAliasNumber'     => new sfWidgetFormFilterInput(),
      'joinTableName'       => new sfWidgetFormFilterInput(),
      'joinTableDescriptor' => new sfWidgetFormFilterInput(),
      'relationName'        => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'owner_id'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('owner'), 'column' => 'id')),
      'ownerclass'          => new sfValidatorPass(array('required' => false)),
      'className'           => new sfValidatorPass(array('required' => false)),
      'fieldName'           => new sfValidatorPass(array('required' => false)),
      'operator'            => new sfValidatorPass(array('required' => false)),
      'valueFrom'           => new sfValidatorPass(array('required' => false)),
      'valueUntil'          => new sfValidatorPass(array('required' => false)),
      'connector'           => new sfValidatorPass(array('required' => false)),
      'warningText'         => new sfValidatorPass(array('required' => false)),
      'whereText'           => new sfValidatorPass(array('required' => false)),
      'whereParams'         => new sfValidatorPass(array('required' => false)),
      'joinAliasNumber'     => new sfValidatorPass(array('required' => false)),
      'joinTableName'       => new sfValidatorPass(array('required' => false)),
      'joinTableDescriptor' => new sfValidatorPass(array('required' => false)),
      'relationName'        => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('filterspec_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'filterspec';
  }

  public function getFields()
  {
    return array(
      'id'                  => 'Number',
      'owner_id'            => 'ForeignKey',
      'ownerclass'          => 'Text',
      'className'           => 'Text',
      'fieldName'           => 'Text',
      'operator'            => 'Text',
      'valueFrom'           => 'Text',
      'valueUntil'          => 'Text',
      'connector'           => 'Text',
      'warningText'         => 'Text',
      'whereText'           => 'Text',
      'whereParams'         => 'Text',
      'joinAliasNumber'     => 'Text',
      'joinTableName'       => 'Text',
      'joinTableDescriptor' => 'Text',
      'relationName'        => 'Text',
    );
  }
}
